(function ($) {
    $.extend({
        week: ["星期天", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
        calcTime: function (time) {

            return time < 10 ? "0" + time : time;
        }

    })
    $.fn.extend({
        timeRun: function () {
            var date = new Date();
            var year = date.getFullYear();
            var month = date.getMonth() + 1;
            var day = date.getDate();
            var week = date.getDay();
            var hour = date.getHours();
            var minute = date.getMinutes();
            var second = date.getSeconds();
            var timeStr = year + "年" + month + "月" + day + "日" + "&nbsp;&nbsp;" + $.week[week] + "&nbsp;&nbsp;" + $.calcTime(hour) + ":" + $.calcTime(minute) + ":" + $.calcTime(second);
            this.html(timeStr);
            var t = this;
            //启动定时器
            window.setTimeout(function () {
                t.timeRun();
            }, 1000);
        }
    })
})(jQuery)